package com.larry.rabbitmq.springbootrabbitmq.consumer;

import com.larry.rabbitmq.springbootrabbitmq.config.ConfirmConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @author larry
 * @Title: larry-rabbitmq
 * @Package com.larry.rabbitmq.springbootrabbitmq.consumer
 * @Description: 报警消费者
 * @date 7/6/213:19 PM
 */

@Slf4j
@Component
public class WarningConsumer {

    @RabbitListener(queues = ConfirmConfig.WARNING_QUEUE_NAME)
    public void receiveWarningMsg(Message message){
        String msg = new String(message.getBody());
        log.error("报警发现不可路由的消息: {}",msg);
    }

}
